<?php
switch ($_REQUEST['sAction'])
{
	case 'usergroup-changeuser':
		$iResult = UsergroupHandler::changeUser($_REQUEST['iUsergroup'], $_REQUEST['iUser'], $_REQUEST['bAdmin']);
		if ($iResult == 1)
		{
			header('Location: index.php?sView=usergroup-view&iUsergroup='.$_REQUEST['iUsergroup']);
			exit();
		}
		break;
	case 'usergroup-adduser':
		$iResult = UsergroupHandler::addUser($_REQUEST['iUsergroup'], @$_REQUEST['iUser'], @$_REQUEST['bAdmin']);
		if ($iResult > 0)
		{
			header('Location: index.php?sView=usergroup-view&iUsergroup='.$_REQUEST['iUsergroup']);
			exit();
		}
		break;
	case 'usergroup-deleteuser':
		$iResult = UsergroupHandler::delUser($_REQUEST['iUsergroup'], $_REQUEST['iUser']);
		if ($iResult == 1)
		{
			header('Location: index.php?sView=usergroup-view&iUsergroup='.$_REQUEST['iUsergroup']);
			exit();
		}
		break;
	case 'usergroup-add':
		$iResult = UsergroupHandler::addUsergroup($_REQUEST['sName']);
		if ($iResult > 0) {
			header('Location: index.php?sView=usergroup-view&iUsergroup='.$iResult);
			exit();
		}
		break;
	case 'usergroup-change':
		$iResult = UsergroupHandler::changeUsergroup($_REQUEST['iUsergroup'], $_REQUEST['sName']);
		if ($iResult == 1) {
			header('Location: index.php?sView=usergroup-list');
			exit();
		}
		break;
	case 'usergroup-delete':
		$iResult = UsergroupHandler::delUsergroup($_REQUEST['iUsergroup']);
		if ($iResult == 1) {
			header('Location: index.php?sView=usergroup-list');
		}
		break;
}
?>
